package
{
	import mx.collections.ArrayCollection;

	public class PresenceStatesList
	{
		protected var ma_list: Array = [];
		private static var m_singleton: PresenceStatesList = new PresenceStatesList();

		public function PresenceStatesList()
		{
		}
		
		public static function getInstance(): PresenceStatesList
		{
			return m_singleton;
		}

		public function add(s_id: String, s_name: String, s_label: String, b_isPrimary: Boolean): void
		{
			if(!s_name)
				s_name = s_label;
			if(!s_label)
				s_label = s_name;
			ma_list.push({ id: s_id, name: s_name, label: s_label, isPrimary: b_isPrimary });
		}

		public function clear(): void
		{
			while(ma_list.length)
				ma_list.pop();
		}

		public function labelForState(s: String): String
		{
			for each(var o: Object in ma_list) {
				if(o.id == s)
					return o.label;
			}
			return null;
		}
		
		public function get states(): Array
		{
			return ma_list;
		}
	}
}